package com.wangsh.usersCenter.users.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.wangsh.usersCenter.common.pojo.BasePojo;

/**
 * 用户api信息表
 * 
 * @author MyPC
 *
 */
public class AUsersApis extends BasePojo<AUsersApis>
{
	private int id;
	private int usersId;
	private String pubKey;
	private String priKey;
	private String extendJSON;
	private byte status;
	private byte isCheck;
	
	private String statusStr;
	/**
	 * 关联关系
	 */
	private AUsers users;
	/*
	 * 方便枚举项在网页上显示出来 键为值(数字),
	 * 值为字符串描述 
	 * 只提供get方法
	 */
	private Map<String,String> enumsMap = new TreeMap<String, String>();
	
	public Map<String, String> getEnumsMap()
	{
		// 根据状态值获取字符串描述
		AUsersApisEnum[] ausersApisEnums = AUsersApisEnum.values();
		for (int i = 0; i < ausersApisEnums.length; i++)
		{
			AUsersApisEnum ausersApisEnum = ausersApisEnums[i];
			String key = ausersApisEnum.toString() ; 
			enumsMap.put(key + "-" + ausersApisEnum.getStatus() + "", ausersApisEnum.getName());
		}
		return enumsMap;
	}
	
	
	public String getStatusStr()
	{
		/* 获取所有的枚举项 */
		AUsersApisEnum[] ausersApisEnums = AUsersApisEnum.values();
		for (int i = 0; i < ausersApisEnums.length; i++)
		{
			AUsersApisEnum ausersApisEnum = ausersApisEnums[i];
			/* 因为枚举项可能有好多,所以需要加一个判断 */
			if(ausersApisEnum.toString().startsWith("STATUS_"))
			{
				if(ausersApisEnum.getStatus() == this.getStatus())
				{
					this.statusStr = ausersApisEnum.getName();
				}
			}
		}
		return statusStr;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getUsersId() {
		return usersId;
	}
	public void setUsersId(int usersId) {
		this.usersId = usersId;
	}
	public String getPubKey() {
		return pubKey;
	}
	public void setPubKey(String pubKey) {
		this.pubKey = pubKey;
	}
	public String getPriKey() {
		return priKey;
	}
	public void setPriKey(String priKey) {
		this.priKey = priKey;
	}
	public String getExtendJSON() {
		return extendJSON;
	}
	public void setExtendJSON(String extendJSON) {
		this.extendJSON = extendJSON;
	}
	public byte getStatus() {
		return status;
	}
	public void setStatus(byte status) {
		this.status = status;
	}
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	public AUsers getUsers() {
		return users;
	}


	public void setUsers(AUsers users) {
		this.users = users;
	}


	public byte getIsCheck() {
		return isCheck;
	}


	public void setIsCheck(byte isCheck) {
		this.isCheck = isCheck;
	}


	public Date getCreateTime() {
		return createTime;
	}


	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	public Date getUpdateTime() {
		return updateTime;
	}


	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}


	public Date getPubTime() {
		return pubTime;
	}


	public void setPubTime(Date pubTime) {
		this.pubTime = pubTime;
	}

}
